<?php
declare (strict_types=1);

namespace Plugin\Alarm\Model;

use App\Model\Permission\User;
use Mine\MineModel;

class RdAlarmHandleRecord extends MineModel
{
    /**
     * The table associated with the model.
     *
     * @var string|null
     */
    protected ?string $table = 'rd_alarm_handle_record';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected array $fillable = [
        'id', 'work_id', 'user_id', 'handle_type', 'handle_info', 'created_at', 'updated_at'
    ];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected array $casts = [
        'id' => 'integer',
        'work_id' => 'integer',
        'user_id' => 'integer',
        'handle_type' => 'integer',
        'handle_info' => 'array',
        'created_at' => 'datetime',
        'updated_at' => 'datetime',
    ];

    public function user()
    {
        return $this->hasOne(User::class, 'id', 'user_id');
    }
}

enum HandleType : int
{
    case Create = 1;
    case Transfer = 2;
    case Accept = 3;
    case Read = 4;
    case Close = 5;
    case Review = 6;
    case Handle_site = 7;
    case Handle_remote = 8;
    case Handle_report = 9;
}